<?php
/**
 * Author:  Liuqiang
 * Email:   872871448@qq.com
 */



/**
 * 加密方法
 *
 * @param $string
 * @param $key
 *
 * @return string
 */
function encrypt($string, $key)
{
    $encrypt_str = openssl_encrypt($string, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
    return base64_encode($encrypt_str);
}

function decrypt($string, $key)
{
    return openssl_decrypt(base64_decode($string), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
}